﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SendMessagelist.aspx.cs"
    Inherits="MxWeiXinPF.Web.admin.users.SendMessagelist" %>

<%@ Import Namespace="MxWeiXinPF.Common" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>用药提醒列表</title>
    <script type="text/javascript" src="../../scripts/jquery/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="../../scripts/lhgdialog/lhgdialog.js?skin=idialog"></script>
    <script type="text/javascript" src="../js/layout.js"></script>
    <link href="../css/pagination.css" rel="stylesheet" type="text/css" />
    <link href="../skin/default/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        //发送短信
        function PostSMS(mobiles) {
            if (mobiles == "") {
                $.dialog.alert('对不起，手机号码不能为空！');
                return false;
            }
            var dialog = $.dialog({
                title: '发送手机短信',
                content: '<textarea id="txtSmsContent" name="txtSmsContent" rows="2" cols="20" class="input"></textarea>',
                min: false,
                max: false,
                lock: true,
                ok: function () {
                    var remark = $("#txtSmsContent", parent.document).val();
                    if (remark == "") {
                        $.dialog.alert('对不起，请输入手机短信内容！', function () { }, dialog);
                        return false;
                    }
                    var postData = { "mobiles": mobiles, "content": remark };
                    //发送AJAX请求
                    $.ajax({
                        type: "post",
                        url: "../../tools/admin_ajax.ashx?action=sms_message_post",
                        data: postData,
                        dataType: "json",
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            $.dialog.alert('尝试发送失败，错误信息：' + errorThrown, function () { }, dialog);
                        },
                        success: function (data, textStatus) {
                            if (data.status == 1) {
                                dialog.close();
                                $.dialog.tips(data.msg, 2, '32X32/succ.png', function () { location.reload(); }); //刷新页面
                            } else {
                                $.dialog.alert('错误提示：' + data.msg, function () { }, dialog);
                            }
                        }
                    });
                    return false;
                },
                cancel: true
            });
        }
    </script>
</head>
<body class="mainbody">
    <form id="form1" runat="server">
    <!--导航栏-->
    <div class="location">
        <a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
        <a href="../center.aspx" class="home"><i></i><span>首页</span></a> <i class="arrow">
        </i><span>短信管理</span> <i class="arrow"></i><span>短信提醒列表</span>
    </div>
    <!--/导航栏-->
    <!--工具栏-->
    <div class="toolbar-wrap">
        <div id="floatHead" class="toolbar">
            <div class="l-list">
                <ul class="icon-list">
                    <li><a class="add" href="SendMessageedit.aspx?action=<%=MXEnums.ActionEnum.Add %>"><i>
                    </i><span>新增</span></a></li>
                    <li style="display:none">
                        <asp:LinkButton ID="btnSmsPost" runat="server" CssClass="list" OnClientClick="return CheckPostBack('btnSmsPost');"
                            OnClick="btnSmsPost_Click"><i></i><span>短信</span></asp:LinkButton></li>
                    <li><a class="all" href="javascript:;" onclick="checkAll(this);"><i></i><span>全选</span></a></li>
                    <li>
                        <asp:LinkButton ID="btnDelete" runat="server" CssClass="del" OnClientClick="return ExePostBack('btnDelete');"
                            OnClick="btnDelete_Click"><i></i><span>删除</span></asp:LinkButton></li>
                </ul>
                <div class="menu-list">
                    <div class="rule-single-select">
                        <asp:DropDownList ID="ddlissend" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlissend_SelectedIndexChanged">
                            <asp:ListItem Value="" Selected="True">全部</asp:ListItem>
                            <asp:ListItem Value="0">未发送</asp:ListItem>
                            <asp:ListItem Value="1">短信发送</asp:ListItem>
                            <asp:ListItem Value="2">微信发送</asp:ListItem>
                        </asp:DropDownList>
                    </div>
                </div>
                <div class="r-list">
                    <asp:TextBox ID="txtKeywords" runat="server" CssClass="keyword" />
                    <asp:LinkButton ID="lbtnSearch" runat="server" CssClass="btn-search" OnClick="btnSearch_Click">查询</asp:LinkButton>
                </div>
            </div>
        </div>
        <!--/工具栏-->
        <!--列表-->
        <asp:Repeater ID="rptList" runat="server" OnItemCommand="rptList_ItemCommand">
            <HeaderTemplate>
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ltable">
                    <tr>
                        <th width="5%">
                            选择
                        </th>
                        <th width="8%">
                            客户姓名
                        </th>
                        <th width="18%">
                            手机号码
                        </th>
                        <%--<th width="8%">药品名称</th>--%>
                        <th width="22%">
                            提醒内容
                        </th>
                        <th width="8%">
                            提醒日期
                        </th>
                        <th width="8%">
                            是否已发送
                        </th>
                        <th width="8%">
                            发送日期
                        </th>
                        <th width="8%">
                            操作
                        </th>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td align="center">
                        <asp:CheckBox ID="chkId" CssClass="checkall" runat="server" Style="vertical-align: middle;" />
                        <asp:HiddenField ID="hidId" Value='<%#Eval("id")%>' runat="server" />
                    </td>
                    <td align="center">
                        <a href="SendMessageedit.aspx?action=<%#MXEnums.ActionEnum.Edit %>&id=<%#Eval("id")%>">
                            <%#Eval("trueName")%></a>
                    </td>
                    <td align="center">
                         <%#Eval("mobile").ToString().Length > 20 ? "" + Eval("mobile").ToString().Substring(1,19) + "" : "" + Eval("mobile") + ""%>
                        <asp:HiddenField ID="hmobile" runat="server" Value='<%#Eval("mobile")%>' /><asp:HiddenField ID="hopenid" runat="server" Value='<%#Eval("openid")%>' />
                    </td>
                    <%--    <td align="center"> <%#Eval("productname")%><asp:HiddenField ID="hproductname" runat="server" Value='<%#Eval("productname")%>' /></td>--%>
                    <td align="left">
                        <%#Eval("MessageContent")%><asp:HiddenField ID="hMessageContent" runat="server" Value='<%#Eval("MessageContent")%>' />
                    </td>
                    <td align="center">
                        <%#Eval("SendDate")%><asp:HiddenField ID="hSendDate" runat="server" Value='<%#Eval("SendDate")%>' />
                    </td>
                    <td align="center">
                        <%#GetisSend(Convert.ToString(Eval("isSend")))%><asp:HiddenField ID="hisSend" runat="server"
                            Value='<%#Eval("isSend")%>' />
                    </td>
                    <td align="center">
                        <%#Eval("SendToDate")%><asp:HiddenField ID="hSendToDate" runat="server" Value='<%#Eval("SendToDate")%>' />
                    </td>
                    <td align="center">
                        <asp:LinkButton ID="lkbSend" runat="server" Text='发提醒' ToolTip="发提醒" CommandName="send"
                            CommandArgument='<%# Eval("ID")%>' OnClientClick="javascript:return confirm('您确定要发送发提醒吗？') "
                            Visible='<%#Eval("isSend").ToString().Equals("0")%>'></asp:LinkButton>
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                <%#rptList.Items.Count == 0 ? "<tr><td align=\"center\" colspan=\"9\">暂无记录</td></tr>" : ""%>
                </table>
            </FooterTemplate>
        </asp:Repeater>
        <!--/列表-->
        <!--内容底部-->
        <div class="line20">
        </div>
        <div class="pagelist">
            <div class="l-btns">
                <span>显示</span><asp:TextBox ID="txtPageNum" runat="server" CssClass="pagenum" onkeydown="return checkNumber(event);"
                    OnTextChanged="txtPageNum_TextChanged" AutoPostBack="True"></asp:TextBox><span>条/页</span>
            </div>
            <div id="PageContent" runat="server" class="default">
            </div>
        </div>
        <!--/内容底部-->
        <asp:TextBox ID="tbReport" runat="server" TextMode="MultiLine" Rows="5" Width="100%"></asp:TextBox>
    </form>
</body>
</html>
